import Vue from 'vue'
import App from './App.vue'
import "bootstrap/dist/css/bootstrap.css"
import "./assets/fonts/iconfont.css"
import VueRouter from 'vue-router'
import axios from 'axios'
// 2. 基础地址
axios.defaults.baseURL = "https://www.escook.cn"
// 3. axios方法添加到Vue的原型上
Vue.prototype.$axios = axios
//1.引入vuex
import Vuex from 'vuex'
//2.让Vue使用 vuex
Vue.use(Vuex)
//3/创建仓库实例

const store = new Vuex.Store({
  state: {
    goodList: [
      {
        name: "诸葛亮",
        price: 1000,
        num: 1,
        checked: false,
      },
      {
        name: "蔡文姬",
        price: 1500,
        num: 1,
        checked: false,
      },
      {
        name: "妲己",
        price: 2000,
        num: 1,
        checked: false,
      },
      {
        name: "鲁班",
        price: 2200,
        num: 1,
        checked: false,
      },
    ],
  },
})

import UIRouter from './views/06-UIRouter'
import Contacts from './views/06-Contacts'
import About from './views/06-About'
import Allcontacts from './views/06-1-Allcontacts'
import Alice from './views/06-1-Alice'
import Bob from './views/06-1-Bob'
import Blog from './views/06-2-blog'
import Fax from './views/06-2-fax'
Vue.use(VueRouter)
const routes = [
  {
    path: "/",
    redirect: '//uIRouter'
  },
  {
    path: "/uIRouter",
    name:'UIRouter',
    component: UIRouter
  },
  {
    path: "/contacts",
    name:'Contacts',
    component: Contacts,
    children:[
      {
        path: "allcontacts",
        name:'Allcontacts',
        component: Allcontacts
      },
      {
        path: "alice",
        name:'Alice',
        component: Alice
      },
      {
        path: "bob",
        name:'Bob',
        component: Bob,
        children:[
          {
            path: "blog",
            name:'Blog',
            component: Blog
          },
          {
            path: "fax",
            name:'Fax',
            component: Fax
          },
        ]
      },
    ]
  },
  {
    path: "/about",
    name:'About',
    component: About
  }
]

const router = new VueRouter({
  routes
})
Vue.config.productionTip = false

new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')
